import Router from "koa-router";
import { getControllers,regControllers } from "../utils/tools.js";
import bodyparser from "koa-bodyparser";
import cors from "@koa/cors";

let router = new Router();
export const usecontrollers = function(app){
    app.use(cors());
    app.use(bodyparser());
    let controllerFiles = getControllers();

    regControllers(router,controllerFiles);
    app.use(router.routes());
}